<?php

  //to do: improve the way to pass two or more parameters in the paged-table ( link )
    
  $aux = explode ( '|', $_GET['id'] );
  $index=0;
  $JobUid = str_replace ( '"', '', $aux[$index++] );

  require_once ( PATH_PLUGINS . 'hr' . PATH_SEP . 'class.hr.php');
  $pluginObj = new hrClass ();

  require_once ( "classes/model/HrJobs.php" );
  //if exists the row in the database propel will update it, otherwise will insert.
  $tr = HrJobsPeer::retrieveByPK( $JobUid  );
  
  if ( ( is_object ( $tr ) &&  get_class ($tr) == 'HrJobs' ) ) { 
     $fields['JOB_UID'] = $tr->getJobUid();
     $fields['LABEL_JOB_UID'] = $tr->getJobUid();
     $fields['EMPLOYEE_ID'] = $tr->getEmployeeId();
     $fields['LABEL_EMPLOYEE_ID'] = $tr->getEmployeeId();
     $fields['POSITION_ID'] = $tr->getPositionId();
     $fields['LABEL_POSITION_ID'] = $tr->getPositionId();
     $fields['BOARDHIREDATE'] = $tr->getBoardhiredate();
     $fields['LABEL_BOARDHIREDATE'] = $tr->getBoardhiredate();
     $fields['TYPEOFAPPOINTMENT_ID'] = $tr->getTypeofappointmentId();
     $fields['LABEL_TYPEOFAPPOINTMENT_ID'] = $tr->getTypeofappointmentId();
//     $fields['ANNUALSALARY'] = $tr->getAnnualsalary();
//     $fields['LABEL_ANNUALSALARY'] = $tr->getAnnualsalary();
     $fields['FTE'] = $tr->getFte();
     $fields['LABEL_FTE'] = $tr->getFte();
//     $fields['HOURLYRATE'] = $tr->getHourlyrate();
//     $fields['LABEL_HOURLYRATE'] = $tr->getHourlyrate();
     $fields['SPREADPAY'] = $tr->getSpreadpay();
     $fields['LABEL_SPREADPAY'] = $tr->getSpreadpay();
//     $fields['NUMBEROFWORKDAYS'] = $tr->getNumberofworkdays();
//     $fields['LABEL_NUMBEROFWORKDAYS'] = $tr->getNumberofworkdays();
     $fields['OTHERPAY'] = $tr->getOtherpay();
     $fields['LABEL_OTHERPAY'] = $tr->getOtherpay();
     $fields['LOCATIONIRN'] = $tr->getLocationirn();
     $fields['LABEL_LOCATIONIRN'] = $tr->getLocationirn();
     $fields['JOBASSIGNMENT'] = $tr->getJobassignment();
     $fields['LABEL_JOBASSIGNMENT'] = $tr->getJobassignment();
     $fields['JOBSTATUS_ID'] = $tr->getJobstatusId();
     $fields['LABEL_JOBSTATUS_ID'] = $tr->getJobstatusId();
     $fields['TERMINATIONDATE'] = $tr->getTerminationdate();
     $fields['LABEL_TERMINATIONDATE'] = $tr->getTerminationdate();
     $fields['PROJECTTERMINATIONDATE'] = $tr->getProjectterminationdate();
     $fields['LABEL_PROJECTTERMINATIONDATE'] = $tr->getProjectterminationdate();
     $fields['PAYUNIT_ID'] = $tr->getPayunitId();
     $fields['LABEL_PAYUNIT_ID'] = $tr->getPayunitId();
     $fields['UNITAMOUNT'] = $tr->getUnitamount();
     $fields['LABEL_UNITAMOUNT'] = $tr->getUnitamount();
     $fields['PAYPLAN_ID'] = $tr->getPayplanId();
     $fields['LABEL_PAYPLAN_ID'] = $tr->getPayplanId();
     $fields['HOURSINDAY'] = $tr->getHoursinday();
     $fields['LABEL_HOURSINDAY'] = $tr->getHoursinday();
     $fields['DAYSINPERIOD'] = $tr->getDaysinperiod();
     $fields['LABEL_DAYSINPERIOD'] = $tr->getDaysinperiod();
//     $fields['BUILDINGPERCENT'] = $tr->getBuildingpercent();
//     $fields['LABEL_BUILDINGPERCENT'] = $tr->getBuildingpercent();
     $fields['FUNCTIONS'] = $tr->getFunctions();
     $fields['LABEL_FUNCTIONS'] = $tr->getFunctions();
     $fields['FUND'] = $tr->getFund();
     $fields['LABEL_FUND'] = $tr->getFund();
     $fields['OBJECT'] = $tr->getObject();
     $fields['LABEL_OBJECT'] = $tr->getObject();
     $fields['OPU'] = $tr->getOpu();
     $fields['LABEL_OPU'] = $tr->getOpu();
     $fields['SPECIALCOSTCENTER'] = $tr->getSpecialcostcenter();
     $fields['LABEL_SPECIALCOSTCENTER'] = $tr->getSpecialcostcenter();
     $fields['SUBJECT'] = $tr->getSubject();
     $fields['LABEL_SUBJECT'] = $tr->getSubject();
     $fields['FUNDSOURCECODE1'] = $tr->getFundsourcecode1();
     $fields['LABEL_FUNDSOURCECODE1'] = $tr->getFundsourcecode1();
     $fields['FUNDSOURCECODE1P'] = $tr->getFundsourcecode1p();
     $fields['LABEL_FUNDSOURCECODE1P'] = $tr->getFundsourcecode1p();
     $fields['FUNDSOURCECODE2'] = $tr->getFundsourcecode2();
     $fields['LABEL_FUNDSOURCECODE2'] = $tr->getFundsourcecode2();
     $fields['FUNDSOURCECODE2P'] = $tr->getFundsourcecode2p();
     $fields['LABEL_FUNDSOURCECODE2P'] = $tr->getFundsourcecode2p();
     $fields['FUNDSOURCECODE3'] = $tr->getFundsourcecode3();
     $fields['LABEL_FUNDSOURCECODE3'] = $tr->getFundsourcecode3();
     $fields['FUNDSOURCECODE3P'] = $tr->getFundsourcecode3p();
     $fields['LABEL_FUNDSOURCECODE3P'] = $tr->getFundsourcecode3p();
     $fields['INSTRUCTIONALLEVEL'] = $tr->getInstructionallevel();
     $fields['LABEL_INSTRUCTIONALLEVEL'] = $tr->getInstructionallevel();
  }
  else
    $fields = array();  
  
  $G_MAIN_MENU = 'processmaker';
  $G_SUB_MENU = 'hr/menuhrEmployee';
  $G_ID_MENU_SELECTED = 'ID_HR_EMP';
  $G_ID_SUB_MENU_SELECTED = 'ID_HR_JOBS';


  $G_PUBLISH = new Publisher;
  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'hr/hrJobsDelete', '', $fields, 'hrJobsDeleteExec' );
  G::RenderPage('publish', 'blank');   
?>